package com.lnsf.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.TableGenerator;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;



@Entity
@Table(name = "Goods")
public class Goods {
	@TableGenerator(
			name = "goodSeq",
			allocationSize = 1,
			initialValue = 1 ,
			pkColumnName = "Pk_name",
			pkColumnValue = "goods_id",
			valueColumnName = "Pk_value"
		)
	@Id
	@GeneratedValue(strategy=GenerationType.TABLE ,generator = "goodSeq")
	private Integer id ;
	
	@Column(nullable=false)
	private String name ;
	
	@Column(nullable=false)
	private Float price ;
	
	@Column(nullable=false)
	@Temporal(TemporalType.DATE)
	private Date  startTime;

	//@Column(nullable=false)
	private String describle;
	
	//'状态 0 未出售， 1 已出售'
	@Column(nullable=false)
	private Integer status;
	
	@ManyToOne(targetEntity=Category.class)
	@JoinColumn(name = "category_id")
	private Category category;
	
	@ManyToOne(targetEntity=User.class)
	@JoinColumn(name = "user_id")
	private User user;
	
	private String image;
	
	
	
	public String getImage() {
		return image;
	}
	public void setImage(String image) {
		this.image = image;
	}
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public Float getPrice() {
		return price;
	}
	public void setPrice(Float price) {
		this.price = price;
	}
	public Date getStartTime() {
		return startTime;
	}
	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}
	public String getDescrible() {
		return describle;
	}
	public void setDescrible(String describle) {
		this.describle = describle;
	}
	public Integer getStatus() {
		return status;
	}
	public void setStatus(Integer status) {
		this.status = status;
	}
	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}
	public Category getCategory() {
		return category;
	}
	public void setCategory(Category category) {
		this.category = category;
	}
	@Override
	public String toString() {
		return "Goods [id=" + id + ", name=" + name + ", price=" + price + ", startTime=" + startTime + ", describle="
				+ describle + ", status=" + status + ", category=" + category + ", user=" + user + ", image=" + image
				+ "]";
	}
	
	
}
